package com.xinyue.game.utils;

import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date;

public class GameDateUtil {
    public static final String DEFAULT_DATA_PATTERN = "yyyy-MM-dd HH:mm:ss";
    /**
     * 返回时间格式：yyyyMMddHHmmss
     */
    public static final DateTimeFormatter YYYYMMDDHHMMSS_PATTERN = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");

    public static String getStandardDate() {
        return LocalDateTime.now().format(DateTimeFormatter.ofPattern(DEFAULT_DATA_PATTERN));
    }

    public static String getStandardDate(long mill) {
        Date date = new Date(mill);
        SimpleDateFormat formatter = new SimpleDateFormat(DEFAULT_DATA_PATTERN);
        return formatter.format(date);
    }

}
